function getUrl(){
    var url = window.location.href;
    var path = window.location.pathname;
    var search = window.location.search;
    url = url.replace(path,"/");
    url = url.replace(search,"")
    return url;
}

$("#changePassword").click(function () {
    const url = getUrl();

    const newPwd = $("#newPwd").val();

    const confirmNewPwd = $("#confirmNewPwd").val();

    const item ={
        "orginPwd":$("#orginPwd").val(),
        "newPwd":newPwd
    }

    console.log(item);

    if(newPwd!=confirmNewPwd){
        $("#changeLog").text("两次输入密码不一致！");
        $("#changeLog").css("color","red");
    }else{

        $.ajax({
            url:url+"studentInfo/changePassword",
            data:JSON.stringify(item),
            type: "post",
            contentType: "application/json; charset=utf-8",
            success: function(map) {
                console.log(map);
                if(map=="pwd error"){
                    $("#changeLog").text("密码错误！");
                    $("#changeLog").css("color","red");
                }
                
            },
            error:function(){
                console.log("----------")
            }
        })

    }
});